
import { AGREE_URL, CODE_URL, SHOW_LIST_URL, USER_REGISTER_URL , TYPES_URL, LOGIN_URL, BASE64_UPLOAD_URL, AUTO_LOGIN_URL} from "../config/userUrl.cfg";
import request from "./ajax";

/** 获取漫展数据的Api */
export function getShowListApi(page:number,size:number) :Promise<any>{
    return request({
        url: SHOW_LIST_URL,
        params: { page, size },
    })
} 

/**获取验证码的Api */
export function getCodeApi(phone:string){
    return request({
        url:CODE_URL,
        data:{phone:phone},
        method:'POST'
    })
}

// 免登录接口
export function autoLoginApi(){
    return request({
        url:AUTO_LOGIN_URL,
        method:'POST'
    })
}

/** 用户注册Api */
export function userRegiseterApi(data:UserInfo) :Promise<any>{
    return request({
        url:USER_REGISTER_URL,
        data,
        method:'PUT'
    })
} 
/**获取用户协议接口 */
export function getAgreeApi(){
    return request({url:AGREE_URL})
}


/** 获取分类数据接口*/
export function getTypesApi(){
    return request({url:TYPES_URL})
}

// 用户登录接口
export function loginApi(phone: string,code: string){
    return request({
        url:LOGIN_URL,
        data:{phone,code},
        method:'POST'
    })
}

/** base64文件上传接口 */
export function base64UploadApi(file: string, name: string): Promise<any> {
    return request({
        url: BASE64_UPLOAD_URL,
        data: {file, name},
        method: 'POST'
    })
}
